﻿using System;
using UnityEngine;

namespace RootMotion.Demos
{
	// Token: 0x020000E5 RID: 229
	public class UserControlThirdPerson : MonoBehaviour
	{
		// Token: 0x06000692 RID: 1682 RVA: 0x0000638C File Offset: 0x0000458C
		public void Start()
		{
			this.cam = Camera.main.transform;
		}

		// Token: 0x06000693 RID: 1683 RVA: 0x0003B418 File Offset: 0x00039618
		public virtual void Update()
		{
			this.state.crouch = (this.canCrouch && Input.GetKey(KeyCode.C));
			this.state.jump = (this.canJump && Input.GetButton("Jump"));
			float axisRaw = Input.GetAxisRaw("Horizontal");
			float axisRaw2 = Input.GetAxisRaw("Vertical");
			Vector3 vector = new Vector3(this.cam.forward.x, 0f, this.cam.forward.z);
			Quaternion rotation = Quaternion.LookRotation(vector.normalized);
			Vector3 vector2 = new Vector3(axisRaw, 0f, axisRaw2);
			this.state.move = rotation * vector2.normalized;
			bool key = Input.GetKey(KeyCode.LeftShift);
			float d = (!this.walkByDefault) ? ((!key) ? 1f : 0.5f) : ((!key) ? 0.5f : 1f);
			this.state.move = this.state.move * d;
			this.state.lookPos = base.transform.position + this.cam.forward * 100f;
		}

		// Token: 0x0400060D RID: 1549
		public bool walkByDefault;

		// Token: 0x0400060E RID: 1550
		public bool canCrouch = true;

		// Token: 0x0400060F RID: 1551
		public bool canJump = true;

		// Token: 0x04000610 RID: 1552
		public UserControlThirdPerson.State state = default(UserControlThirdPerson.State);

		// Token: 0x04000611 RID: 1553
		public Transform cam;

		// Token: 0x020000E6 RID: 230
		public struct State
		{
			// Token: 0x04000612 RID: 1554
			public Vector3 move;

			// Token: 0x04000613 RID: 1555
			public Vector3 lookPos;

			// Token: 0x04000614 RID: 1556
			public bool crouch;

			// Token: 0x04000615 RID: 1557
			public bool jump;
		}
	}
}
